using UnityEngine;

public class AdBase : IAd
{
	//protected AndroidJavaObject _aJavaObject;

	public bool enable
	{
		get;
		set;
	}

	public void CallMethod(string name, params object[] agrus)
	{
		if (!AdManagerOld.ENABLE || Application.platform != RuntimePlatform.Android)
		{
			return;
		}
		/* if (_aJavaObject == null)
		{
			UnityEngine.Debug.LogError("android java object is null, current platform : " + Application.platform);
			return;
		}
		if (agrus.Length != 0)
		{
			_aJavaObject.Call(name, agrus);
		}
		else
		{
			_aJavaObject.Call(name);
		} */
		UnityEngine.Debug.Log("Call java method : " + name + " , agrus : " + agrus);
	}

	public T CallMethod<T>(string name, params object[] agrus)
	{
		if (!AdManagerOld.ENABLE)
		{
			return default(T);
		}
		/* if (Application.platform == RuntimePlatform.Android)
		{
			if (_aJavaObject == null)
			{
				UnityEngine.Debug.LogError("android java object is null, current platform : " + Application.platform);
				return default(T);
			}
			UnityEngine.Debug.Log("Call java method : " + name + " , agrus : " + agrus);
			return _aJavaObject.Call<T>(name, agrus);
		} */
		return default(T);
	}

	public void Init()
	{
		/* if (Application.platform == RuntimePlatform.Android)
		{
			AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
			_aJavaObject = androidJavaClass.GetStatic<AndroidJavaObject>("currentActivity");
			if (_aJavaObject == null)
			{
				UnityEngine.Debug.LogError("Can not fetch the android java object");
			}
		} */
	}

	public void ShowInterstitial()
	{
		CallMethod("ShowInterstitial");
	}

	public void ShowInterstitial(string pageType, int adType, int customVal)
	{
		CallMethod("ShowInterstitial", pageType, adType, customVal);
	}

	public void ShowSpecialInterstitial(bool isShowBefore, string pageType, int adType, int customVal)
	{
		CallMethod("ShowSpecialInterstitial", isShowBefore, pageType, adType, customVal);
	}

	public virtual void ShowBanner(int anchor)
	{
		CallMethod("ShowBanner", anchor);
	}

	public void HideBanner()
	{
		CallMethod("HideBanner");
	}

	public bool HasBanner()
	{
		return CallMethod<bool>("HasBanner", new object[0]);
	}

	public void ShowVideo(int customVal)
	{
		CallMethod("ShowVideo", customVal);
	}

	public bool HasVideo()
	{
		return CallMethod<bool>("HasVideo", new object[0]);
	}

	public void ShowMore()
	{
		CallMethod("ShowMore");
	}

	public bool HasMore()
	{
		return CallMethod<bool>("HasMore", new object[0]);
	}

	public void ShowNative(int width, int height, int x, int y)
	{
		CallMethod("ShowNative", width, height, x, y);
	}

	public bool HasNative()
	{
		return CallMethod<bool>("HasNative", new object[0]);
	}

	public void HideNative()
	{
		CallMethod("HideNative");
	}

	public bool HasInterstitialGift(string pageType)
	{
		return CallMethod<bool>("HasInterstitialGift", new object[1]
		{
			pageType
		});
	}

	public void ShowGift(string pageType, int customVal)
	{
		CallMethod("ShowGift", pageType, customVal);
	}

	public bool CheckCtrl(string key)
	{
		return CallMethod<bool>("CheckCtrl", new object[1]
		{
			key
		});
	}

	public bool HasInterstitial(string pageType)
	{
		return CallMethod<bool>("HasInterstitial", new object[1]
		{
			pageType
		});
	}

	public void TrackEvent(string key)
	{
		CallMethod("TrackAdjustEvent", key);
	}

	public void ShowExit()
	{
		CallMethod("ShowExit");
	}

	public void SetNotificationText(string title, string longTimePass, string oneDayPass)
	{
		CallMethod("SetNotificationText", title, longTimePass, oneDayPass);
	}
}
